<?xml version="1.0"
      encoding="UTF-8"
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>LDAP的内存泄露</title>
<meta name="generator" content="http://txt2tags.sf.net" />
</head>
<body>

<div class="header" id="header">
<a name='toptopSlJDRUNVS' id='toptopSlJDRUNVS'></a><h1>LDAP的内存泄露</h1>
<h2>-- Python说:不是俺的错！</h2>
</div>

<div class="toc" id="toc">
</div>
<div class="body" id="body">
<dl>
<dt>故事:</dt><dd>
    友人在折腾<a href="http://www.openldap.org/">LDAP</a> ,使用Python 的 <a href="http://twistedmatrix.com/">Twisted</a> 组件来开发时应用常常死亡，
    怀疑Python的内存泄露，但是找不到证据……
</dd>
<dt>结局:</dt><dd>
    找到高人<a href="http://blog.delphij.net/">delphj</a> 运用内存分析工具:
<pre>
/usr/ports/devel/valgrind&gt; cat pkg-descr
Valgrind is a system for debugging and profiling un*x programs. With the tools
that come with Valgrind, you can automatically detect many memory management
and threading bugs, avoiding hours of frustrating bug-hunting, making your
programs more stable. You can also perform detailed profiling, to speed up and
reduce memory use of your programs.

The Valgrind distribution includes five tools: two memory error detectors, a
thread error detector, a cache profiler and a heap profiler. Several other
tools have been built with Valgrind.

Valgrind was ported to FreeBSD by Doug Rabson (http://www.rabson.org/).

WWW: http://valgrind.kde.org/

</pre>
    才发现是<a href="http://www.openldap.org/">LDAP</a>本身的问题：
    每次RPC 的远程连接结束后，会泄露 32字节的内存！
    晕哪！怪不得叫 LDAP, 因为很轻的连接情况下的确很不容易发觉，在当前内存动不动就上Gb的情况下…………
<p></p>
    <b>Python的虚拟机是非常坚固的！不要轻易怀疑吧……</b>
</dd>
</dl>

<p>
<img align="middle" src="/pybimage/technorati-over.gif" border="0" alt=""/>
    <a href="http://www.technorati.com/tags/Zen">Zen</a>
    ,<a href="http://www.technorati.com/tags/python">Python</a>
    ,<a href="http://www.technorati.com/tags/ldap">ldap</a>
    ,<a href="http://www.technorati.com/tags/computer">computer</a>
</p>
<hr class="light" />
<ul>
<li>动力源自::<b><a href="http://txt2tags.sf.net">txt2tags</a></b>
</li>
<li>t2t渲染:: 2010-10-09 02:21:39
</li>
</ul>

</div>

<!-- xhtml code generated by txt2tags 2.4 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags ./techic/ldap-valgrind-2006-03-17-17-00.t2t -->
</body></html>
